#pragma once
#include "TLV.hpp"
#include <vector>
#include <cstdint>

namespace linkfabric {
struct MessageHeader {
    uint8_t version;
    uint8_t msg_type;
    uint8_t flags;         // bit0: encrypted
    uint32_t total_length;
    uint16_t channel_id;
};

class Message {
public:
    MessageHeader header;
    std::vector<TLV> body;

    std::vector<uint8_t> encode() const;
    static Message decode(const std::vector<uint8_t>& raw);
};
}
